import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author dreamcatcher
 * @date 2022/3/2 17:11
 * 选择匹配符
 */
public class RegExp04 {
    public static void main(String[] args) {
        String content = "abcdefDEF";
        String regStr = "abc|DEF";

        Pattern pattern = Pattern.compile(regStr);
        Matcher matcher = pattern.matcher(content);
        while (matcher.find()){
            System.out.println(matcher.group(0));
        }
    }
}
